<?php
class Parceria_ConsultaController extends Zend_Controller_ActionAquiles {

    public function init() {
        parent::init();
        $this->view->title = 'Pesquisa de Parceria.';
    }
    
    public function indexAction(){
        $this->view->form = new Application_Form_Parceria_Busca();
    }
	
    public function listaAction(){
        
        $dado = $this->buscaDados();
        $labels = array('dt_expiracao','dt_cadastro','dt_exclusao');
        $labelsVlr = array('valor');
        $xml = $this->populaXml($dado,$labels,$labelsVlr);
        die($xml);
    }

    private function buscaDados(){
        $model = Application_Model_Parceria::getInstance();
        $forme = new Application_Form_Parceria_Busca();
        $forme->setDefaults($this->_request->getPost());
        
        $page = $this->_getParam("page");
        $rp = $this->_getParam("rp");
        $sortname = $this->_getParam("sortname");
        $sortOrder = $this->_getParam("sortorder");
        
        return $model->lista($page, $rp, $sortname, $sortOrder, $forme->getValues());
    }
}